﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Documents;

namespace Kokomo
{
	public static class TableHelper
	{
		public static TableCell CreateTextCell(string text)
		{
			TableCell cell = new TableCell();
			Paragraph paragraph = new Paragraph(new Run() { Text = text });
			cell.Blocks.Add(paragraph);

			return cell;
		}
		public static void AddCellWith(this TableRow tableRow, string text)
		{
			tableRow.Cells.Add(CreateTextCell(text));
		}
		public static void AddRow(this TableRowGroup rowGroup, params string[] cells)
		{
			TableRow row = new TableRow();
			foreach (var text in cells)
			{
				row.AddCellWith(text);
			}
			rowGroup.Rows.Add(row);
		}
	}
}
